

import { message } from "antd";
import { Navigate } from "react-router-dom";
import { getUserToken } from "../../utils";

function AuthRoute({ children }) {
  const hasToken = getUserToken()
  if (hasToken) {
    return <>{children}</>
  } else {
    message.info('登录过期,请重新登录')
    return <Navigate to='/login' replace />
  }
}

export { AuthRoute }



